package cn.marinda.resturants.mapper;

import cn.marinda.resturants.entity.Permission;
import cn.marinda.resturants.entity.User;
import cn.marinda.resturants.global.Pages;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.context.annotation.Primary;

/** 权限mappers
 * @date 2021/11/16
 * @author Marinda
 */
public interface PermissionMapper extends BaseMapper<Permission> {

    @Select("select child_uid from r_permissions where uid = #{uid}")
    long selectChildUid(long uid);

    @Select("select name from r_permissions where uid = #{uid}")
    String selectName(long uid);

    @Select("select parent_uid from r_permissions where uid = #{uid}")
    long selectParentUid(long uid);

    /** 分页User
     *
     * @param page 传输page数据
     * @return 迭代的page
     */
    @Select("select * from r_permissions")
    IPage<Permission> selectPages(Pages<?> page);
}
